//
//  TZzhuceViewController.m
//  XMLYFM
//
//  Created by dllo on 15/12/31.
//  Copyright © 2015年 zzl. All rights reserved.
//

#import "TZzhuceViewController.h"
#import <SMS_SDK/SMSSDK.h>
#import <SMS_SDK/SMSSDKCountryAndAreaCode.h>
#import <SMS_SDK/SMSSDK+DeprecatedMethods.h>
#import <SMS_SDK/SMSSDK+ExtexdMethods.h>
#import "TZZhuceNextcontroller.h"


@interface TZzhuceViewController ()<UIAlertViewDelegate,UITextFieldDelegate>

@end

@implementation TZzhuceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    
    self.view.backgroundColor  = [UIColor whiteColor];
    self.shouji.layer.borderColor = [UIColor grayColor].CGColor;
    self.shouji.layer.borderWidth = 1;
    
    
    
    
}

//下一步点击事件
- (IBAction)nextBtnAction:(UIButton *)sender

{
    
    NSString *phoneStr = self.phoneText.text;
    UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"surephonenumber", nil)
                                                    message:phoneStr delegate:self
                                          cancelButtonTitle:NSLocalizedString(@"cancel", nil)
                                          otherButtonTitles:NSLocalizedString(@"sure", nil), nil];
    [alert show];

    
//    NSLog(@"2222");
    
}


-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    NSString *str2 = @"86";
    
    if (1 == buttonIndex)
    {
        [SMSSDK getVerificationCodeByMethod:SMSGetCodeMethodSMS phoneNumber:self.phoneText.text
                                       zone:str2
                           customIdentifier:nil
                                     result:^(NSError *error)
         {
             
             if (!error)
             {
                 TZZhuceNextcontroller *Tzzhuce = [[TZZhuceNextcontroller alloc]init];
                 Tzzhuce.phoneNumber = self.phoneText.text;
                 [self.navigationController pushViewController:Tzzhuce animated:YES];
                 NSLog(@"验证码发送成功");
                 
             
             
             }
             else
             {
                 
                 NSString *messageStr = [NSString stringWithFormat:@"%zidescription",error.code];
                 UIAlertView* alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"codesenderrtitle", nil)
                                                                 message:NSLocalizedString(messageStr, nil)
                                                                delegate:self
                                                       cancelButtonTitle:NSLocalizedString(@"sure", nil)
                                                       otherButtonTitles:nil, nil];
                 [alert show];
             }
             
         }];
        
    }

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/


@end
